﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="Tempo.aspx.cs" Inherits="GPSTracker.Views.Master.Tempo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <link href="../CSS/Tempo.css" rel="stylesheet" />
    <script src="../JS/TempoJS.js"></script>

    <script language="javascript" type="text/javascript">

        function Fade(div) {
            setTimeout("document.getElementById('" + div + "').style.display='none'", 4000);
        }

        function showLoadingPanelDemo() {
            clientLoadingPanelDemo.Show();
        }

        function hideLoadingPanelDemo() {
            clientLoadingPanelDemo.Hide();
        }
    </script>

    <script src="../JS/jquery-1.10.2.js"></script>

    <asp:ScriptManager ID="scrptMgr" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>

            <script type="text/javascript">
                $(window).ready(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                $(window).resize(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                var prm = Sys.WebForms.PageRequestManager.getInstance();

                prm.add_endRequest(function () {
                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);
                });
            </script>

            <style type="text/css">
                #container {
                    position: relative;
                    min-height: 150px;
                }

                #sidebar {
                    position: absolute;
                    left: 0;
                    top: 0;
                    height: 100%;
                    width: 100%;
                    overflow-y: scroll;
                }
            </style>

            <dx:ASPxLoadingPanel ID="ASPxLoadingPanelDemo" runat="server" 
                ClientInstanceName="clientLoadingPanelDemo">
            </dx:ASPxLoadingPanel>
            <dx:ASPxCallback ID="ASPxCallbackDemo" runat="server" 
                        ClientInstanceName="clientCallbackDemo" >
                        <ClientSideEvents EndCallback="function(s, e) {
			                hideLoadingPanelDemo();
		                }" />
                    </dx:ASPxCallback>
            <div id="container">
                <div id="sidebar">

                    <table cellspacing="5" cellpadding="5" width="98%" border="0" align="center">
                        <tr>
                            <td style="width: 100%; height: 100%; text-align: center;">
                                <fieldset class="FiledSetDesign" style="border: 1px solid #cccccc; padding: 0; margin: 0;">
                                    <legend class="PageHeading" align="center" style="font-weight: bold; font-size: 18px; text-align: center;">
                                        <asp:Label ID="lblHead" runat="server" Text="Tempo Profile Master"></asp:Label>
                                    </legend>

                                    <table style="width: 100%; height: 100%" align="center" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td style="padding: 5px; width: 100%; height: 89%; overflow: auto;">
                                                <dx:ASPxGridView ID="grdView" runat="server" AutoGenerateColumns="false"
                                                    ClientInstanceName="grdView" OnCustomButtonCallback="grdView_CustomButtonCallback"
                                                    KeyFieldName="TempoID" EnableCallBacks="false" DataSourceID="SqlDataSource1">
                                                    <Columns>
                                                        <dx:GridViewCommandColumn VisibleIndex="0">
                                                            <ClearFilterButton Visible="True">
                                                            </ClearFilterButton>
                                                            <CustomButtons>
                                                                <dx:GridViewCommandColumnCustomButton ID="btnEdit" Text="Edit">
                                                                </dx:GridViewCommandColumnCustomButton>
                                                                <dx:GridViewCommandColumnCustomButton ID="btnDelete" Text="Delete">
                                                                </dx:GridViewCommandColumnCustomButton>
                                                            </CustomButtons>
                                                        </dx:GridViewCommandColumn>
                                                        <dx:GridViewDataColumn FieldName="TempoID" VisibleIndex="1" Visible="false"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="WhouseCode" Caption="WareHouse" VisibleIndex="2"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="TempoNo" VisibleIndex="3"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="DriverName" VisibleIndex="4"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MobileNo1" Caption="Mobile No. 1" VisibleIndex="5"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MobileNo2" Caption="Mobile No. 2" VisibleIndex="6"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="EmailID" VisibleIndex="7"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="AccessCode" VisibleIndex="8"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="AccessPwd" VisibleIndex="9"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="IsActiveStr" Caption="Is Active" VisibleIndex="10"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CreatedBy" Caption="Created By" VisibleIndex="11"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CreatedDttm" VisibleIndex="12" Visible="false"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ModifiedBy" VisibleIndex="13" Visible="false"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ModifiedDttm" VisibleIndex="14" Visible="false"></dx:GridViewDataColumn>
                                                    </Columns>
                                                    <Settings ShowFilterRow="True" />
                                                    <SettingsPager PageSize="20">
                                                        <PageSizeItemSettings Visible="true" Items="20, 50, 100, 200"/>
                                                    </SettingsPager>
                                                    <ClientSideEvents CustomButtonClick="function(s, e) {
                                                                if (e.buttonID == 'btnDelete'){
                                                                    e.processOnServer = confirm('Are you sure You Want To Delete???');
                                                                }
                                                                if(e.buttonID == 'btnEdit')
                                                                {
                                                                    e.processOnServer = true;
                                                                    showLoadingPanelDemo();	
							                                        clientCallbackDemo.PerformCallback('callback');
                                                                }
                                                            }" />
                                                </dx:ASPxGridView>
                                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MainConn %>" SelectCommand="SELECT * FROM VW_GetTempoMaster"></asp:SqlDataSource>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding-top: 5px; padding-left: 5px; padding-right: 5px; height: 1%;">
                                                <hr style="height: 2px; border-style: solid; border-width: 1px 0 0 0; border-color: #cccccc;" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 30%; padding-left: 5px; padding-bottom: 5px; height: 10%;">
                                                <table style="width: 100%">
                                                    <tr>
                                                        <td style="float: left;">
                                                            <dx:ASPxButton ID="btnNew" runat="server" Text="Add New" Width="80"
                                                                OnClick="btnNew_Click">
                                                                <ClientSideEvents Click="function(s, e)
                                                                {
                                                                    e.processOnServer = true; 
                                                                    showLoadingPanelDemo();	
							                                        clientCallbackDemo.PerformCallback('callback');
                                                                }
                                                            " />
                                                            </dx:ASPxButton>
                                                        </td>
                                                        <td style="float: left; padding-left: 5px;">
                                                            <dx:ASPxButton ID="btnRefresh" runat="server" Text="Refresh" OnClick="btnRefresh_Click"
                                                                Width="80">
                                                                <ClientSideEvents Click="function(s, e)
                                                                {
                                                                    e.processOnServer = true; 
                                                                    showLoadingPanelDemo();	
							                                        clientCallbackDemo.PerformCallback('callback');
                                                                }
                                                            " />
                                                            </dx:ASPxButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                    </table>

                    <dx:ASPxPopupControl ID="popup" ClientInstanceName="popup" runat="server" AllowDragging="true"
                        Width="440" ShowShadow="False"
                        PopupHorizontalAlign="WindowCenter" HeaderText="Add Tempo" PopupVerticalAlign="WindowCenter">
                        <ContentCollection>
                            <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                                <table width="100%" cellpadding="2" cellspacing="0">
                                    <tr>
                                        <td colspan="2" align="left" style="padding-bottom: 5px;">Field Marks With (<span style="color: Red;">*</span>) Are Mandatory<hr style="height: 2px; border-style: solid; border-width: 1px 0 0 0; border-color: #cccccc;" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="50%" align="left" style="padding-bottom: 5px;">Tempo No. <span style="color: Red;">*</span><br />
                                            <dx:ASPxTextBox ID="txtTempoNo" runat="server" Width="200" CssClass="AllControls">
                                                <ClientSideEvents KeyUp="function(s, e) {
                                                            s.SetText(s.GetText().toUpperCase());
                                                            }" />
                                            </dx:ASPxTextBox>
                                            <asp:HiddenField ID="hdnTempoID" runat="server" />
                                        </td>
                                        <td width="50%" align="left" style="padding-bottom: 5px;">Warehouse<br />
                                            <dx:ASPxComboBox ID="cmbWarehouse" runat="server"
                                                IncrementalFilteringMode="Contains"
                                                Width="200" OnDataBound="cmb_DataBound" CssClass="AllControls" 
                                                OnSelectedIndexChanged="cmbWarehouse_SelectedIndexChanged" AutoPostBack="true">
                                            </dx:ASPxComboBox>
                                        </td>
                                        
                                    </tr>
                                    <%--<tr>
                                        <td style="padding-bottom: 5px;">Mobile No <span style="color: Red;">*</span><br />
                                            <dx:ASPxTextBox ID="txtMobileNo" runat="server" Width="200" CssClass="AllControls">
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td style="padding-bottom: 5px;">Email ID
                                    <br />
                                            <dx:ASPxTextBox ID="txtEmailID" runat="server" Width="200" CssClass="AllControls">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>--%>
                                    <tr>
                                        <td  align="left" style="padding-bottom: 5px;">Driver Name <span style="color: Red;">*</span><br />
                                            <dx:ASPxComboBox ID="cmbDriver" runat="server"
                                                IncrementalFilteringMode="Contains"
                                                Width="200" OnDataBound="cmb_DataBound" CssClass="AllControls">
                                            </dx:ASPxComboBox>
                                        </td>
                                        <td style="padding-bottom: 5px;">Access Code <span style="color: Red;">*</span>
                                            <br />
                                            <dx:ASPxTextBox ID="txtAccessCode" runat="server" Width="200" CssClass="AllControls">
                                            </dx:ASPxTextBox>
                                        </td>
                                    </tr>
                                    <tr>                                        
                                        <td style="padding-bottom: 5px;">Access Password <span style="color: Red;">*</span>
                                            <br />
                                            <dx:ASPxTextBox ID="txtAccessPwd" runat="server" Width="200" CssClass="AllControls">
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td style="padding-bottom: 5px;">
                                            <dx:ASPxCheckBox ID="chkIsActive" runat="server" Text="Is Active">
                                            </dx:ASPxCheckBox>
                                        </td>
                                    </tr>                                    
                                    <tr>
                                        <td style="padding-top: 5px;">
                                            <hr style="height: 2px; border-style: solid; border-width: 1px 0 0 0; border-color: #cccccc;" />
                                        </td>
                                        <td style="padding-top: 5px;">
                                            <hr style="height: 2px; border-style: solid; border-width: 1px 0 0 0; border-color: #cccccc;" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding-right: 10px; text-align: left; float: left; width: 50%;">
                                            <dx:ASPxButton ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" Width="80">
                                                <ClientSideEvents Click="function(s, e)
                                            {
                                                if(Validate() == true)
                                                {
                                                    e.processOnServer = true; 
                                                    showLoadingPanelDemo();	
							                        clientCallbackDemo.PerformCallback('callback'); 
                                                }
                                                else
                                                {
                                                    e.processOnServer = false;
                                                }
                                            }
                                        " />
                                            </dx:ASPxButton>
                                            <dx:ASPxButton ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" Width="80">
                                                <ClientSideEvents Click="function(s, e)
                                            {
                                                if(Validate() == true)
                                                {
                                                    e.processOnServer = true; 
                                                    showLoadingPanelDemo();	
							                        clientCallbackDemo.PerformCallback('callback');
                                                }
                                                else
                                                {
                                                    e.processOnServer = false;
                                                }
                                            }
                                        " />
                                            </dx:ASPxButton>
                                        </td>
                                        <td style="width: 50%; text-align: left; vertical-align: middle;">
                                            <dx:ASPxLabel ID="lblMessage" runat="server" Visible="false" Text="">
                                            </dx:ASPxLabel>
                                        </td>
                                    </tr>
                                </table>
                            </dx:PopupControlContentControl>
                        </ContentCollection>
                    </dx:ASPxPopupControl>

                </div>
            </div>

        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
